﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<TPOJ.Model.Contest>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Contests
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Contests</h2>

    <table>
        <tr>
            <th>
                ID
            </th>
            <th>
                Title
            </th>
            <th>
                Description
            </th>
            <th>
                StartTime
            </th>
            <th>
                EndTime
            </th>
            <th>
                Status
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <%= Html.Encode(item.UniqueID) %>
            </td>
            <td>
                <%= Html.ActionLink(item.Title, "Details", "Contest", new { id = item.UniqueID }, null)%>
            </td>
            <td>
                <%= Html.Encode(item.Description) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.StartTime)) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.EndTime)) %>
            </td>
            <td>
                <%= Html.Encode(TPOJ.Web.Utils.ComputeStatus(item.StartTime,item.EndTime)) %>
            </td>
        </tr>
    
    <% } %>

    </table>

</asp:Content>

